package com.mikasa.springboot.example.elasticsearch;

import com.mikasa.springboot.example.domain.elasticsearch.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by User on 17/1/22.
 */

@Service
public class BookService {

    @Autowired
    private BookRepository bookRepository;

    public Book save(Book book){
        return bookRepository.save(book);
    }

    public void delete(String id){
        bookRepository.delete(id);
    }

    public List<Book> findByTitle(String title){
        return bookRepository.findByTitle(title);
    }

    public List<Book> findByAuthor(String author){
        return bookRepository.findByAuthor(author);
    }
}
